using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class UP_ExTablesMap : EntityTypeConfiguration<UP_ExTables>
    {
        public UP_ExTablesMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Table_name, t.Fields });

            // Properties
            this.Property(t => t.Table_name)
                .IsRequired()
                .HasMaxLength(75);

            this.Property(t => t.Fields)
                .IsRequired()
                .HasMaxLength(1915);

            // Table & Column Mappings
            this.ToTable("UP_ExTables");
            this.Property(t => t.Table_name).HasColumnName("Table_name");
            this.Property(t => t.Fields).HasColumnName("Fields");
        }
    }
}
